/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package lab8;


public class Cos extends Functie {
public static double calcul(double aux1)
{
return Math.cos(aux1);
}
    @Override
public double calcul()
{
if (fStang == null)
System.exit(1);
return calcul(fStang.calcul());
}
    @Override
public String derivare()
{
if (fStang == null)
System.exit(1);

return "-("+Produs.concatTermens(fStang.derivare(),Sin.concatTermeni(fStang.toString()))+")";
}
    @Override
public double calculDerivata()
{
if (fStang == null)
System.exit(1);
return Produs.Calcul(fStang.calculDerivata(),
-Sin.calcul(fStang.calcul()));
}
    @Override
public String toString()
{
if (fStang == null)
System.exit(1);
return concatTermeni(fStang.toString());
}
public static String concatTermeni(String aux1)
{
String aux;
int nrP;
nrP = aux1.charAt(0) == '(' ? 0 : 2;
aux = "cos";
if (nrP != 0) aux += "(";
aux += aux1;
if (nrP != 0) aux += ")";
return aux;
}
}
